﻿package  
{
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	import flash.geom.Point;
	
	/**
	* ...
	* @author DefaultUser (Tools -> Custom Arguments...)
	*/
	public class Animation 
	{
		private var frames:Array;
		private var timer:Number = 0;
		public var currentFrame:uint = 0;
		private var frameLength:Number = 1 / 5;
		private var NumFrames:uint;
		private var _texture:String;
		public var bDying:Boolean = false;
		public var bDead:Boolean = false;

		
		public function Animation(numFrames:uint)
		{
			NumFrames = numFrames;		
		}
		public function get CurrentFrame():uint
		{
			return currentFrame;
		}
		
		public function Update():void
		{
			timer += Constants.TIME_STEP;

			if (timer >= frameLength)
			{
				timer = 0;
				currentFrame = (currentFrame + 1) % NumFrames;
				if (bDying && currentFrame == NumFrames - 1)
				{
					bDead = true;
				}
				
			}
		}

		
		public function get FramesPerSecond():uint
		{
			return 1 / frameLength;
		}
		public function set FramesPerSecond(value:uint):void
		{
			frameLength = Number(1 / Number(value));
		}
		public function Reset():void
		{
			currentFrame = 0;
			timer = 0;
		}
		







		
	}
	
}